﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NewUIConceptTest
{
    public class ConsoleSprite : ISprite
    {
        private ConsoleColor _backgroundColor;
        private ConsoleColor _foregroundColor;
        private Int32 _width;
        private Int32 _height;
        private Char _character;

        public Char Character
        {
            get { return _character; }
            set { _character = value; }
        }

        public ConsoleColor BackgroundColor
        {
            get { return _backgroundColor; }
            set { _backgroundColor = value; }
        }

        public ConsoleColor ForegroundColor
        {
            get { return _foregroundColor; }
            set { _foregroundColor = value; }
        }

        #region ISprite Members

        public Int32 Width
        {
            get { return _width; }
            set { _width = value; }
        }

        public Int32 Height
        {
            get { return _height; }
            set { _height = value; }
        }

        #endregion

        #region Implementation of IDrawable

        public void Draw(ICanvas canvas)
        {
            ConsoleCanvas consoleCanvas = canvas as ConsoleCanvas;

            if (consoleCanvas == null)
            {
                return;
            }

            consoleCanvas.Write(_character);
        }

        #endregion
    }
}
